﻿<%@ Page Title="" Language="C#" MasterPageFile="~/presentation/MasterPage.Master"
    AutoEventWireup="true" CodeBehind="PobytDetail.aspx.cs" Inherits="ISHotel.presentation.PobytDetail" %>

<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=4.1.51116.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table>
        <tr>
            <td>
            </td>
            <td align="center">
                <asp:Label ID="LabelNadpis" runat="server" Text="Informace o pobytu:" Font-Bold="True"
                    Font-Size="Small"></asp:Label>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelID_Pobytu" runat="server" Text="ID Pobytu:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelID_Pobytu2" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelHost" runat="server" Text="Jméno hosta:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelHost2" runat="server"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelHost3" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelPrijezd" runat="server" Text="Příjezd:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelPrijezd2" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelOdjezd" runat="server" Text="Odjezd:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelOdjezd2" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelTaxa" runat="server" Text="Taxa:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelTaxa2" runat="server"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelTaxa3" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelPokoj" runat="server" Text="Pokoj:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelPokoj2" runat="server"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelPokoj3" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelStravovani" runat="server" Text="Stravování:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelStravovani2" runat="server"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelStravovani3" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelCena" runat="server" Text="Celková cena:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="LabelCena2" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelZaplaceno" runat="server" Text="Zaplaceno:"></asp:Label>
            </td>
            <td>
                <asp:CheckBox ID="CheckBoxZaplaceno" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBoxZaplaceno_CheckedChanged" />
            </td>
        </tr>
    </table>
    <br />
    <div>
        <table>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="Přidej službu:" Font-Bold="True" Font-Size="Small"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label5" runat="server" Text="Služba:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="DropDownListNazevSluzby" runat="server" DataSourceID="ODS_NazevSluzby"
                        DataTextField="nazev_sluzby" DataValueField="id_sluzby">
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="ODS_NazevSluzby" runat="server" SelectMethod="Select" TypeName="ISHotel.Database.SluzbaTable">
                    </asp:ObjectDataSource>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label6" runat="server" Text="Množství:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBoxMnozstvi" runat="server" MaxLength="2"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidatorTelDetail" runat="server"
                        ErrorMessage="Jen čísla!" ValidationExpression="\d+" ControlToValidate="TextBoxMnozstvi"
                        ValidationGroup="Sluzba"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="Button1" runat="server" Text="Přidej" OnClick="Button1_Click" ValidationGroup="Sluzba" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Label ID="LabelErr" runat="server" Visible="True" ForeColor="Red"></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    <br />
    <div>
        <asp:GridView ID="GridViewSluzby" runat="server" AutoGenerateColumns="False" DataSourceID="ODS_Sluzby"
            AllowPaging="True" DataKeyNames="id_sluzby, id_pobytu" AllowSorting="False">
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:ImageButton ID="ImageButtonDel" runat="server" CommandArgument='<%# Eval("id_sluzby") %>'
                            CommandName="DeleteObjednavkuSluzby" OnCommand="button_Command" ImageUrl="~/images/delete.jpg"
                            OnClientClick="javascript: return confirm(&apos;Opravdu smazat objednavku sluzby?&apos;);" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="id_sluzby" HeaderText="ID služby" SortExpression="id_sluzby"
                    ItemStyle-HorizontalAlign="Center" />                
                <asp:BoundField DataField="nazev_sluzby" HeaderText="Název služby" SortExpression="nazev_sluzby"
                    ItemStyle-HorizontalAlign="Center" />
                <asp:BoundField DataField="cena_sluzby" HeaderText="Cena služby" SortExpression="cena_sluzby"
                    ItemStyle-HorizontalAlign="Center" />
                <asp:BoundField DataField="mnozstvi_sluzeb" HeaderText="Množství služeb" SortExpression="mnozstvi_sluzeb"
                    ItemStyle-HorizontalAlign="Center" />
                <asp:CommandField ShowSelectButton="True" SelectImageUrl="../images/pencil.gif" ButtonType="Image"
                    ItemStyle-HorizontalAlign="Center" />
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="ODS_Sluzby" runat="server" SelectMethod="Select" TypeName="ISHotel.Database.ObjednavkaSluzbyTable"
            DeleteMethod="Delete">
            <DeleteParameters>
                <asp:Parameter Name="id_sluzby" Type="int32" />
            </DeleteParameters>
        </asp:ObjectDataSource>
        <br />
        <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="300px" AutoGenerateRows="False"
            DataSourceID="ODS_SluzbaDetail">
            <Fields>
                <asp:TemplateField HeaderText="ID služby" SortExpression="id_sluzby">
                    <ItemTemplate>
                        <asp:Label ID="LabelSluzby1" runat="server" Text='<%# Bind("id_sluzby") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="LabelSluzby2" runat="server" Text='<%# Bind("id_sluzby") %>'></asp:Label>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("id_sluzby") %>' MaxLength="2"></asp:TextBox>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ID pobytu" SortExpression="id_pobytu">
                    <ItemTemplate>
                        <asp:Label ID="Labelpobytu1" runat="server" Text='<%# Bind("id_pobytu") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Labelpobytu2" runat="server" Text='<%# Bind("id_pobytu") %>'></asp:Label>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Název služby" SortExpression="nazev_sluzby">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("nazev_sluzby") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("nazev_sluzby") %>'></asp:Label>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Cena služby" SortExpression="cena_sluzby">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("cena_sluzby") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("cena_sluzby") %>'></asp:Label>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Množství služeb" SortExpression="mnozstvi_sluzeb">
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("mnozstvi_sluzeb") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("mnozstvi_sluzeb") %>' MaxLength="2"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidatorTelDetail" runat="server"
                            ErrorMessage="Jen čísla!" ValidationExpression="\d+" ControlToValidate="TextBox7"
                            ValidationGroup="Detail">
                        </asp:RegularExpressionValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("mnozstvi_sluzeb") %>' MaxLength="2"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidatorTelDetail" runat="server"
                            ErrorMessage="Jen čísla!" ValidationExpression="\d+" ControlToValidate="TextBox8"
                            ValidationGroup="Detail">
                        </asp:RegularExpressionValidator>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="Edit"></asp:LinkButton>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                            Text="Update"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="Cancel"></asp:LinkButton>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Insert"
                            Text="Insert"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="Cancel"></asp:LinkButton>
                    </InsertItemTemplate>
                </asp:TemplateField>
            </Fields>
        </asp:DetailsView>
        <asp:ObjectDataSource ID="ODS_SluzbaDetail" runat="server" SelectMethod="Select"
            InsertMethod="Insert" OnUpdated="SluzbyDetail_OnUpdated" DataObjectTypeName="ISHotel.Database.ObjednavkaSluzby"
            TypeName="ISHotel.Database.ObjednavkaSluzbyTable" UpdateMethod="Update">
            <SelectParameters>
                <asp:ControlParameter PropertyName="SelectedValue" Type="int32" Name="id_sluzby"
                    ControlID="GridViewSluzby"></asp:ControlParameter>
                <asp:ControlParameter PropertyName="Text" Type="int32" Name="id_pobytu" ControlID="LabelID_Pobytu2">
                </asp:ControlParameter>
            </SelectParameters>
        </asp:ObjectDataSource>
    </div>
    <div>
        <asp:Button ID="ButtonFaktura" runat="server" Text="Vytiskni doklad" OnClick="ButtonFaktura_Click"
            Enabled="false" />
    </div>
</asp:Content>
